﻿<%@ Page Language="C#" MasterPageFile="~/InventoryTracker/MasterPage.master" AutoEventWireup="true" CodeFile="InvoiceDetails.aspx.cs" Inherits="InventoryTracker_InvoiceDeta" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="maincontent" Runat="Server">


<div id="projectreport">
        <a name="content_start0" id="content_start0"></a>
        <fieldset>
            <h2 class="none">
                Invoice Master</h2>
            <legend>Invoice Information</legend>
            <div class="formsection">
                Invoice</div>
                
                
                        <asp:Label ID="lblInvNo" runat="server" Text="Invoice No."></asp:Label>
                        <br />
                    <asp:DropDownList ID="ddrInvNo" runat="server" DataSourceID="InvNoDaSo" 
                            DataTextField="InvoiceNumber" DataValueField="InvoiceNumber" Height="22px" 
                            Width="128px" AutoPostBack="True" 
                onselectedindexchanged="ddrInvNo_SelectedIndexChanged"></asp:DropDownList>
                    
                        <asp:SqlDataSource ID="InvNoDaSo" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                            SelectCommand="SELECT [InvoiceNumber] FROM [Invoice]"></asp:SqlDataSource>
              <br /> 
              <p>
              <table>
              <asp:Label ID="CustInfoLabel" runat="server" Text="Customer Information:" 
                      Font-Bold="True" Font-Underline="True"></asp:Label>
              
              <tr>
              <td>
              <asp:Label ID="CustInfLabel" runat="server" Font-Bold="True"></asp:Label>
              </td >
              <td>
              
              <asp:Label ID="CustLabel" runat="server"></asp:Label>
            
              </td>
              </tr>
              </table>                                    
           </p>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT [CustName], [CustAddr1], [CustAddr2], [CustAddr3], [CustCity], [CustState], [CustStatus], [CustFax], [CustMobile], [CustPhone], [CustCountry], [CustEmail], [CustZipCode] FROM [CustomerMaster] WHERE ([CustStatus] &gt; @CustStatus)">
                <SelectParameters>
                    <asp:Parameter DefaultValue="0" Name="CustStatus" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
              
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" 
                            DataSourceID="InvoDetailsDS" ForeColor="#333333" 
                GridLines="None" ShowFooter="True" AllowPaging="True" AllowSorting="True" 
                PageSize="5" style="Width:30%">
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <Columns>
                        <asp:BoundField HeaderText="Item Name" DataField="InvoiceItem" 
                            SortExpression="InvoiceItem" />
                        <asp:BoundField DataField="ItemDescription" HeaderText="Description" 
                            SortExpression="ItemDescription" />
                        <asp:BoundField DataField="InvoiceItemRate" HeaderText="Rate" 
                            SortExpression="InvoiceItemRate" />
                        <asp:BoundField DataField="InvoiceItemQty"  HeaderText="Quantity" 
                            SortExpression="InvoiceItemQty" FooterText="Total:" />
                        
                            
                        <asp:TemplateField HeaderText="Total Amount" FooterStyle-Font-Bold="True">
                        <ItemTemplate>
                        <%# GetTotalAmount(decimal.Parse(Eval("InvoiceTotalAmount").ToString())).ToString("N2")%>
                        </ItemTemplate>
                        <FooterTemplate>
                        <%# GetTotal().ToString("N2") %>
                        </FooterTemplate>
                        <FooterStyle Font-Bold="True"></FooterStyle>
                        </asp:TemplateField> 
                    </Columns>
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" 
                        Font-Overline="False" HorizontalAlign="Justify" />
                        </asp:GridView>
                
                

                        <asp:SqlDataSource ID="InvoDetailsDS" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT [InvoiceItem], [ItemDescription], [InvoiceItemRate], [Tax], [InvoiceTotalAmount], [InvoiceDate], [InvoiceItemQty], [InvoiceDiscount] FROM [InvoiceDetails] WHERE ([InvoiceNumber] = @InvoiceNumber)">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="ddrInvNo" Name="InvoiceNumber" 
                                    PropertyName="SelectedValue" Type="Int32" />
                            </SelectParameters>
            </asp:SqlDataSource>
                
                



                

<table style="top: 72px; left: 1009px; position: absolute; height: 108px; width: 136px; ">
<tr>
<td>

<p >
                        <asp:Label ID="lblDateTime" runat="server" Text="Date"></asp:Label>
                         <asp:TextBox ID="txtDateTime" runat="server" 
                             
                            Enabled="False"></asp:TextBox>
                        </p>

<p style="height: 44px; width: 127px" >
                        <asp:Label ID="lblPlace" runat="server" Text="Place"></asp:Label>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPlace"
                        ErrorMessage="*" ></asp:RequiredFieldValidator>
                          <br />                
                        <asp:TextBox ID="txtPlace" runat="server" ontextchanged="txtPlace_TextChanged"></asp:TextBox>
                        </p>
                        
       </td>
</tr>
</table>



<script runat="server">
    decimal TotalAmount;
    decimal GetTotalAmount(decimal Amount)
    {
        TotalAmount += Amount;
        return Amount;
    }
    decimal GetTotal()
    {
        return TotalAmount;
    }
</script>

<table  style="width:30%"  >
<tr>
<td align="right" style="width:75%">
    <asp:Label ID="DiscountLabel" runat="server" Text="Discount:" Font-Bold="True" Align="right"></asp:Label>
</td>
<td>
<asp:Label ID="DiscLabel" runat="server"></asp:Label>
  
  
</td>
</tr>
<tr>
<td  align="right" style="width:75%">
<asp:Label ID="TaxLabel" runat="server" Text="Tax:" Font-Bold="True"   ></asp:Label>  
</td>
<td>
<asp:Label ID="TaxxLabel" runat="server"></asp:Label>

</td>
</tr>

   <tr>
<td align="right" style="width:75%">
    <asp:Label ID="GrandTotLabel" runat="server" Text="Grand Total:" Font-Bold="True" Align="right"></asp:Label>
</td>
<td>
<asp:Label ID="GraTotLabel2" runat="server" Font-Overline="True"></asp:Label>
  
  
</td>
</tr> 
    


</table>


<div class="formsection">
            
                <asp:Button ID="btnLocSubmit" runat="server" Text="Submit" 
                    />
                        <asp:Label ID="lblResult" runat="server"></asp:Label>
               
            </div>

 </fieldset>
</div>
</asp:Content>

